package com.yy.hi.library.hilog;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * User: gongyongfeng2@yy.com
 * Date: 2020/6/10 20 :56
 */
public class HiLogManager {
    private HiLogConfig mHiLogConfig;
    private static HiLogManager sHiLogManager;
    private List<HiLogPrint> printers = new ArrayList<>();

    private HiLogManager(HiLogConfig hiLogConfig, HiLogPrint[] prints) {
        this.mHiLogConfig = hiLogConfig;
        this.printers.addAll(Arrays.asList(prints));
    }

    public static HiLogManager getInstance() {
        return sHiLogManager;
    }

    public static void init(@NotNull HiLogConfig hiLogConfig, HiLogPrint... prints) {
        sHiLogManager = new HiLogManager(hiLogConfig, prints);
    }

    public List<HiLogPrint> getPrinters() {
        return printers;
    }

    public void addPrinter(HiLogPrint print) {
        printers.add(print);
    }

    public void removePrinter(HiLogPrint print) {
        printers.remove(print);
    }

    public HiLogConfig getConfig() {
        return mHiLogConfig;
    }
}
